package top.hooray.delayedpayment.entity;

import javax.persistence.*;
import java.util.List;

/**
 * @author hooray
 * @date 2021/3/9 22:30
 */
@Entity
@Table(name = "d_order")
public class Order {

    @Id
    private Long orderId;

    @Column(nullable = false)
    private String userId;

    @Column(nullable = false)
    private OrderStatus status;

    @OneToMany(cascade={ CascadeType.ALL })
    @JoinColumn(name="orderId")
    private List<OrderDetail> orderDetails;

    @Override
    public String toString() {
        return "Order{" +
                "orderId=" + orderId +
                ", userId='" + userId + '\'' +
                ", status=" + status +
                ", orderDetails=" + orderDetails +
                '}';
    }

    public Long getOrderId() {
        return orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public OrderStatus getStatus() {
        return status;
    }

    public void setStatus(OrderStatus status) {
        this.status = status;
    }

    public List<OrderDetail> getOrderDetails() {
        return orderDetails;
    }

    public void setOrderDetails(List<OrderDetail> orderDetails) {
        this.orderDetails = orderDetails;
    }
}
